package net.muchine.core.domain.user;

import java.util.LinkedHashMap;
import java.util.Map;

public class Preference {
	private Long seq;
	private Long userSeq;
	
	private boolean hideEmail;
	private String timeZone;
	private DisplayComments displayComments;
	private boolean warnUnsavedText;
	
	private EmailNotification emailNotification;
	private boolean notifyMyChanges;
	
	public Preference() {
		this.hideEmail = false;
		this.displayComments = DisplayComments.CHRONOLOGICAL;
		this.warnUnsavedText = true;
		
		this.emailNotification = EmailNotification.INVOLVED;
		this.notifyMyChanges = false;
	}
	
	public enum DisplayComments {
		 CHRONOLOGICAL("In chronological order")
		,REVERSE("In reverse chronological order");
		
		private String description;
		
		private DisplayComments(String description) {
			this.description = description;
		}
		
		public String getDescription() {
			return description;
		}
		
		public static Map<String, String> getMap() {
			Map<String, String> map = new LinkedHashMap<String, String>();
			
			for (DisplayComments entity : DisplayComments.values())
				map.put(entity.toString(), entity.getDescription());
			
			return map;
		}
	}
	
	public enum EmailNotification {
		 ANY("For any event on all my projects")
		,INVOLVED("Only for things I watch or I'm involved in")
		,ASSIGNED("Only for things I am assigned to")
		,OWN("Only for things I am the owner of")
		,NONE("No events");
		
		private String description;
		
		private EmailNotification(String description) {
			this.description = description;
		}
		
		public String getDescription() {
			return description;
		}
		
		public static Map<String, String> getMap() {
			Map<String, String> map = new LinkedHashMap<String, String>();
			
			for (EmailNotification entity : EmailNotification.values())
				map.put(entity.toString(), entity.getDescription());
			
			return map;
		}
	}
	
	public Long getSeq() {
		return seq;
	}
	public void setSeq(Long seq) {
		this.seq = seq;
	}
	public Long getUserSeq() {
		return userSeq;
	}
	public void setUserSeq(Long userSeq) {
		this.userSeq = userSeq;
	}
	public boolean isHideEmail() {
		return hideEmail;
	}
	public void setHideEmail(boolean hideEmail) {
		this.hideEmail = hideEmail;
	}
	public String getTimeZone() {
		return timeZone;
	}
	public void setTimeZone(String timeZone) {
		this.timeZone = timeZone;
	}
	public DisplayComments getDisplayComments() {
		return displayComments;
	}
	public void setDisplayComments(DisplayComments displayComments) {
		this.displayComments = displayComments;
	}
	public boolean isWarnUnsavedText() {
		return warnUnsavedText;
	}
	public void setWarnUnsavedText(boolean warnUnsavedText) {
		this.warnUnsavedText = warnUnsavedText;
	}
	public EmailNotification getEmailNotification() {
		return emailNotification;
	}
	public void setEmailNotification(EmailNotification emailNotification) {
		this.emailNotification = emailNotification;
	}
	public boolean isNotifyMyChanges() {
		return notifyMyChanges;
	}
	public void setNotifyMyChanges(boolean notifyMyChanges) {
		this.notifyMyChanges = notifyMyChanges;
	}
	
	public static void main(String[] args) {
		Map<String, String> map = DisplayComments.getMap();
		System.out.println(map.get("CHRONOLOGICAL"));
		System.out.println(map.get("REVERSE"));
	}
}
